package com.shixun.dds_11.mapper;

import com.shixun.dds_11.dto.OrderSubmitDTO;
import com.shixun.dds_11.dto.OrdersInfoDTO;
import com.shixun.dds_11.entity.DdsOrderDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author YSP
 * @since 2024-07-05
 */
public interface DdsOrderDetailMapper extends BaseMapper<DdsOrderDetail> {

    /**
     * 提交方法
     * @param ordersDetailDTO
     */
    @Insert("insert into dds_order_detail (id, order_no, goods_name, " +
            "goods_price, goods_count, goods_unit, order_id, goods_id, subtotal) values (#{detailId}, " +
            "#{no}, #{goodsName}, #{goodsPrice}, #{goodsCount}, #{goodsUnit}, #{id}, #{goodsId}, #{subtotal})")
    void save(OrderSubmitDTO ordersDetailDTO);

    /**
     * 根据id查询
     * @param ordersInfoDTO
     * @return
     */
    @Select("select * from dds_order_detail where order_id = #{id}")
    DdsOrderDetail select(OrdersInfoDTO ordersInfoDTO);
}
